package com.itheima.d2_collection_nesting;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.function.BiConsumer;

/*
      目标：理解集合的嵌套。
      江苏省 = "南京市","扬州市","苏州市","无锡市","常州市"
      湖北省 = "武汉市","孝感市","十堰市","宜昌市","鄂州市"
      河北省 = "石家庄市","唐山市", "邢台市", "保定市", "张家口市"
 */
public class Test {
    public static void main(String[] args) {
        HashMap<String, ArrayList<String>> map = new HashMap<>();
        ArrayList<String> js = new ArrayList<>();
        ArrayList<String> hb = new ArrayList<>();
        ArrayList<String> heb = new ArrayList<>();
        Collections.addAll(js,"南京市","扬州市","苏州市","无锡市","常州市");
        Collections.addAll(hb,"武汉市","孝感市","十堰市","宜昌市","鄂州市");
        Collections.addAll(heb,"石家庄市","唐山市", "邢台市", "保定市", "张家口市");
        map.put("江苏省:",js);
        map.put("湖北省:",hb);
        map.put("河北省:",heb);

       map.forEach(new BiConsumer<String, ArrayList<String>>() {
           @Override
           public void accept(String string, ArrayList<String> strings) {
               System.out.print(string+" ");
               for (String s : strings) {
                   System.out.print(s+" ");
               }
               System.out.println();
           }
       });

    }
}
